<?php
/**
 * 提现 记录
 */

namespace app\admin\controller;


use app\admin\model\PointsRecord;
use app\admin\model\UserModel;
use app\common\controller\Controller;
use think\Request;

use think\Db;
use think\Exception;

class Points extends Controller
{

    public function getIndex(Request $request)
    {
        $user_id= $request->param('user_id');

        $keyword=$request->param('keyword');

        $order_type=$request->param('order_type',1);


        if($keyword)
        {
            $user_id = UserModel::getUserIdByUserName($keyword);

        }

        $query =PointsRecord::getRecordQuery($user_id);


        if($order_type == 1)
        {
            $query->order('record_addtime desc');
        }else{
            $query->order('record_addtime');
        }
        $this->assign([
            'list'=>$query->paginate(),
            'keyword'=>$keyword,
            'order_type'=>$order_type,

        ]);

        return $this->fetch('index');
    }

}